home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9042 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.umbc.edu!not-for-mail
  2. From: schlein@umbc.edu (Jonas J. Schlein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Nedd help!!! <depth of recursion>
  5. Date: 7 Mar 1996 18:33:41 -0500
  6. Organization: University of Maryland Baltimore County
  7. Message-ID: <4hnrol$5ts@umbc9.umbc.edu>
  8. References: <JSA.96Feb16135027@organon.com> <4hl082INNc7d@keats.ugrad.cs.ubc.ca> <JSA.96Mar7145352@organon.com> <Pine.SUN.3.91.960307161803.17639A-100000@thomas.helios.nd.edu>
  9. NNTP-Posting-Host: umbc9.umbc.edu
  10. NNTP-Posting-User: schlein
  11.  
  12. Ron Fodor  <rfodor@thomas.helios.nd.edu> wrote:
  13. |> Anybody,
  14. |>   I need help writing a program.  The program is the Ackermann's 
  15. |> function.  It is defined like this...
  16. |> 
  17. |> Ack(m,n) = {n+1        if    m=0
  18. |>         Ack(m-1,n)    if    n=0
  19. |>         Ack(m-1,Ack(m,n-1)     }
  20. |> 
  21. |> My problem is computing the depth of recursion of the procedure <Ack(m,n)>.
  22. |> Any algorithm for finding it would be GREATLY appreciated.
  23. |> Thanks...
  24.  
  25. Well I highly suspect this is a homework assignment since you are
  26. posting from a *.edu site. However, I will give you this hint...Add
  27. a global variable to your program called 'depth' and increment it everytime
  28. Ack() is called.
  29. -- 
  30. "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
  31.  
  32. Jonas J. Schlein  (schlein@gl.umbc.edu)
  33.